package com.changgou.controller;

import com.changgou.common.pojo.Result;
import com.changgou.common.pojo.StatusCode;
import com.changgou.goods.pojo.Sku;
import com.changgou.service.ISkuInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/search")
public class SkuController {
    @Autowired
    private ISkuInfoService skuInfoService;

    /**
     * 讲sku商品导入ES服务器
     * @return
     */
    @GetMapping("/import")
    public Result imPortSkuDbToEs(){
        skuInfoService.imPortSkuDbToEs();
        return new Result(true, StatusCode.OK,"商品添加ES成功");
    }
    @PostMapping
    public Map search(@RequestBody Map<String,String> map){
        Map resule = skuInfoService.search(map);
        return resule;
    }
}
